package main

import "fmt"

func main() {
	//创建父类的对象
	p1 := Person1{name: "扎红伞", age: 18, sex: "男"}
	fmt.Println(p1)
	fmt.Println(p1.name, p1.age, p1.sex)

	//2、创建子类的对象
	s1 := Student{Person1{"李四", 22, "男"}, "打篮球"}
	fmt.Println(s1)
	s2 := Student{Person1{"王二狗", 21, "男"}, "打豆豆"}
	fmt.Println(s2)

	var s3 Student
	s3.Person1.name = "王小鸭"
	s3.Person1.age = 16
	s3.Person1.sex = "女"
	s3.skill = "跳舞"
	fmt.Println("name:", s3.name, "age:", s3.age, "sex:", s3.sex)

}

type Person1 struct {
	name string
	age  int
	sex  string
}

type Student struct {
	Person1
	skill string
}
